package com.hqyj.javaGraduation.hotel.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hqyj.javaGraduation.hotel.pojo.HotelMenu;
import com.hqyj.javaGraduation.hotel.pojo.HotelPackage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

@Mapper
@Repository
public interface HotelMenuDao extends BaseMapper<HotelMenu> {

    @Insert("INSERT INTO hotel_menu_package (menu_id,pac_id) VALUES (#{menuId},#{pacId})")
    Integer addMenuToPkg(Integer menuId,Integer pacId);

    @Delete("DELETE FROM hotel_menu_package where menu_id=#{menuId} AND pac_id=#{pacId}")
    Integer delMenuPkg(Integer menuId,Integer pacId);

    @Select("SELECT hp.pac_id,hp.pac_name,hp.pac_cost,hp.pac_price,hm.*" +
            "FROM hotel_package hp  JOIN hotel_menu_package hmp ON hmp.pac_id=hp.pac_id  JOIN hotel_menu hm ON hmp.menu_id=hm.menu_id")
    List<HotelPackage> getMenuPkg();

}
